//
//  FKBalanceItemCell.m
//  WanTao
//
//  Created by Macbook Pro on 2019/3/28.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKBalanceItemCell.h"

@interface FKBalanceItemCell ()

@property (nonatomic, weak) UILabel *marketPriceLabel;
@property (nonatomic, weak) UILabel *priceLabel;

@end

@implementation FKBalanceItemCell

- (void)setupSubviews
{
    [super setupSubviews];
    [self.contentView fk_viewCornerRadius:5 borderWidth:1 borderColor:fkMainColor];
    
    UILabel *priceLabel = [UILabel fk_labelWithFont:fk_adjustFont(18) textColor:fkMainColor textAlignment:NSTextAlignmentCenter];
    [self.contentView addSubview:priceLabel];
    self.priceLabel = priceLabel;
    
    UILabel *marketPriceLabel = [UILabel fk_labelWithFont:fk_adjustFont(12) textColor:fkMainColor textAlignment:NSTextAlignmentCenter];
    [self.contentView addSubview:marketPriceLabel];
    self.marketPriceLabel = marketPriceLabel;
    
    [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.offset(0);
        make.bottom.equalTo(self.mas_centerY).offset(fk_adjustW(-6));
    }];
    [marketPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(priceLabel);
        make.top.equalTo(self.mas_centerY).offset(fk_adjustW(6));
    }];
}

- (void)setData:(id)data
{
    [super setData:data];
    
    self.priceLabel.text = fkFORMAT(@"%@元", data[@"price"]);
    self.marketPriceLabel.text = fkFORMAT(@"售价: %@元", data[@"markprice"]);
}

//- (void)setSelected:(BOOL)selected
//{
//    [super setSelected:selected];
//    
//    if (selected) {
//        self.priceLabel.textColor = [UIColor whiteColor];
//        self.marketPriceLabel.textColor = [UIColor whiteColor];
//        self.contentView.backgroundColor = fkMainColor;
//        [self.contentView fk_viewCornerRadius:5 borderWidth:0 borderColor:nil];
//    } else {
//        self.priceLabel.textColor = fkMainColor;
//        self.marketPriceLabel.textColor = fkMainColor;
//        self.contentView.backgroundColor = [UIColor whiteColor];
//        [self.contentView fk_viewCornerRadius:5 borderWidth:1 borderColor:fkMainColor];
//    }
//}

@end
